using B.S.Domain.审计字段;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.Domain.InvoiceManagement
{
    /// <summary>
    /// 销售发票明细表
    /// 用于存储销售发票的具体商品明细信息
    /// </summary>
    public class SalesInvoiceDetail : BaseModel
    {
        /// <summary>
        /// 发票明细ID
        /// </summary>
        [Key]
        public int DetailId { get; set; }

        /// <summary>
        /// 发票ID
        /// 外键，关联到SalesInvoice表
        /// </summary>
        public int InvoiceId { get; set; }

        /// <summary>
        /// 发票导航属性
        /// 用于实体框架Core的关系映射
        /// </summary>
        [ForeignKey("InvoiceId")]
        public virtual SalesInvoice Invoice { get; set; }

        /// <summary>
        /// 商品名称
        /// 发票明细中的商品名称
        /// </summary>
        public string ProductName { get; set; }

        /// <summary>
        /// 商品编号
        /// 商品的唯一标识符
        /// </summary>
        public string ProductCode { get; set; }

        /// <summary>
        /// 规格型号
        /// 商品的规格和型号
        /// </summary>
        public string Specifications { get; set; }

        /// <summary>
        /// 单位
        /// 商品的计量单位
        /// </summary>
        public string Unit { get; set; }

        /// <summary>
        /// 数量
        /// 商品的数量
        /// </summary>
        [Column(TypeName = "decimal(18,0)")]
        public decimal Quantity { get; set; }

        /// <summary>
        /// 单价
        /// 商品的不含税单价
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 金额
        /// 商品的不含税金额（单价 * 数量）
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal Amount { get; set; }

        /// <summary>
        /// 税率
        /// 商品适用的税率
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal TaxRate { get; set; }

        /// <summary>
        /// 税额
        /// 商品包含的税额
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal TaxAmount { get; set; }

        /// <summary>
        /// 备注
        /// 商品明细的备注信息
        /// </summary>
        public string Remarks { get; set; }
    }
}